/**
 * 给定两个立方体求是否有体积大于0的公共交集
 * 标程的做法如下：
 *   首先判定一维线段是有正长度的交集
 *   def f(a, b, c, d):
 *       return (not b <= c) and (not d <= a)
 *   然后对于三维的每一维都要求f成立即可，即
 *   f(第一维) and f(第二维) and f(第三维)
 * 
 * 首先判断如下：
 * 如果A的顶点在B中或者B的顶点在A中，则return true
 * 否则就要三段相交，其实与标程是一样的。
 */
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;

using llt = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vll = vector<llt>;

template<typename T>
istream & operator >> (istream & is, vector<T> & v){
    for(auto & i : v) is >> i;
    return is;
}

template<typename T>
void input(vector<T> & v, int n){
    v.assign(n + 1, {});
    for(int i=1;i<=n;++i) cin >> v[i];
    return;
}

struct Point{
    int x, y, z;
    void input(){
        cin >> x >> y >> z;
    }
};

pair<Point, Point> A, B;
void input(pair<Point, Point> & v){
    Point a; a.input();
    Point b; b.input();
    v = {a, b};
    // v.first.x = min(a.x, b.x);
    // v.first.y = min(a.y, b.y);
    // v.first.z = min(a.z, b.z);
    // v.second.x = max(a.x, b.x);
    // v.second.y = max(a.y, b.y);
    // v.second.z = max(a.z, b.z);   
    return;
}

bool isIn(int xmin, int xmax, int x){
    return min(xmin, xmax) < x and x < max(xmin, xmax);
}

bool isIn(const pair<Point, Point> & a, const Point & p){
    return isIn(a.first.x, a.second.x, p.x) and isIn(a.first.y, a.second.y, p.y) and isIn(a.first.z, a.second.z, p.z);
}

bool isInter(int a, int b, int c, int d){
    if(isIn(a, b, c) or isIn(a, b, d)) return true;
    if(isIn(c, d, a) or isIn(c, d, b)) return true;
    return false;
}

bool proc(){
    if(isIn(A, B.first) or isIn(A, B.second)) return true;
    if(isIn(B, A.first) or isIn(B, A.second)) return true;
    
    if(isInter(A.first.x, A.second.x, B.first.x, B.second.x)
    and isInter(A.first.y, A.second.y, B.first.y, B.second.y)
    and isInter(A.first.z, A.second.z, B.first.z, B.second.z)){
        return true;
    }

    return false;
}

void work(){
    input(A); input(B);
    cout << (proc() ? "Yes\n" : "No\n");
    return;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
    return 0;
}